#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
//#include <string>
using namespace std;
#include "string.h"

int main()
{
	ljt::string str1("hello world");
	cout << str1.c_str() << endl;

	auto str2 = str1;
	cout << str2.c_str() << endl;

	for (int i = 0; i < str1.size(); i++)
		cout << str1[i] << ' ';

	cout << endl;

	cout << str1[11];
	cout << str1.size() << str1.capacity() << endl;

	str1[0] = 'x';
	cout << str1[0] << endl;

	ljt::string const str3(str1);
	cout << str3[0] << endl;
	//str3[0] = 'h';
	str1 += 'x';
	cout << str1.c_str() << endl;
	str1 += "123";
	cout << str1.c_str() << endl;

	for (auto& ele : str1)
		cout << ele;
	cout << endl;
	ljt::string str0("hello world");
	str0.insert(0, 5, '#');
	cout << str0.c_str() << endl;

	ljt::string str4("hello world");
	str4.insert(5, "#####");
	cout << str4.c_str() << endl;

	str4.erase(5, 5);
	cout << str4.c_str() << endl;
	str4.erase(0, 5);
	cout << str4.c_str() << endl;
	str4.erase(2);
	cout << str4.c_str() << endl;

	ljt::string str5("hello world");
	cout << str5.find(0, 'l') << ' ' << str5.find(str5.size(), 'o') << endl;

	cout << str5.find(0, "o") << ' ' << str5.find(str5.size(), 'o') << endl;

	cout << str5.sub_str(0, 5).c_str() << endl << str5.sub_str(0, 5).c_str() << endl << str5.sub_str().c_str() << endl;

	ljt::string str6(str1);
	cout << str6.c_str() << endl;
	/*string str1("hello world");
	cout << str1[11];*/
	//string str1("123");
	//string str2("654");
	//str2 = "123";
	//cout << str2 << endl;

	ljt::string str7("hello world");
	cout << str7 << endl;
	str7.resize(15, 'Y');
	cout << str7 << endl;
	str7 += '\0';
	str7 += "123";
	cout << str7 << endl;
	str7 += "123";
	cout << str7 << endl;

	/*ljt::string str8;
	cin >> str8;
	cout << str8 << endl;*/

	ljt::string s1("123  123");
	ljt::string s2("123  123");
	cout << (s1 == s2) << endl;
	cout << (s1 < s2) << endl;

	return 0;
}